package com.hl233.framework.demo;

import com.hl233.framework.BootApplication;
import com.hl233.framework.utils.EnvironmentBean;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.Map;

/**
 * @author 张振强15065206763
 * @create 2024-09-06
 */
@SpringBootTest(classes = BootApplication.class)
public class GetValue {

    @Value("${spring.datasource.driverClassName}")
    private String res;

    @Autowired
    private EnvironmentBean environmentBean;

    @Test
    public void value(){

        System.out.println("查看res:"+res);

    }

    @Test
    public void test(){
        String myProperty = environmentBean.getEnvironment().getProperty("druid.datasource.url");
        System.out.println("changshi:"+myProperty);
    }

}
